#!/bin/bash

# 源码地址 https://github.com/brgl/libgpiod/tree/v1.6.x

# imx6
# TARGET_CC = /opt/gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc
# imx8
# TARGET_CC = /opt/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc
# cx7101
# TARGET_CC = /opt/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi-gcc

#export CROSS_COMPILE=<交叉编译工具链前缀>
export CROSS_COMPILE=/opt/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
export CC=${CROSS_COMPILE}gcc
export CXX=${CROSS_COMPILE}g++
export AR=${CROSS_COMPILE}ar
export AS=${CROSS_COMPILE}as
export LD=${CROSS_COMPILE}ld
export RANLIB=${CROSS_COMPILE}ranlib
export STRIP=${CROSS_COMPILE}strip
echo "cross ok"

# 编译说明
# 1: 先执行 make clean 
#    source build.sh，注意修改交叉编译工具链
# 2：执行 ./autogen.sh
# 3: 修改交叉编译工具链和生成目标文件路径
#    ./configure --enable-tools=yes --host=aarch64-linux-gnu --prefix=/home/djq/mokar/cv2x_libs/libserialport-0.1.1/targets/imx8/
# 4：make
# 5：make install
# 6：libserialport-0.1.1/targets/imx8/ 路径下会生成目标文件
# 7: 测试代码请参考  hl_test/imx8 路径